const path=require("path");
const webpackPlugin=require("html-webpack-plugin");

module.exports={
    mode: "production",
    entry: {
      index:"./newHTML/src/index.ts",
      about:"./newHTML/src/about.ts"
    },
    output: {
        filename: "[name].js",
        path:path.resolve(__dirname,"dist"),
        clean: true
    },
    module: {
        rules:[
            {
                test: /\.ts$/,
                loader: "ts-loader",
                exclude: /node_modules/
            },
            {
                test:/\.css$/,
                use: ["style-loader","css-loader"]
            }
        ]
    },
    resolve: {
        extensions: [".ts",".js"]
    },
    devServer: {
        static: path.resolve(__dirname,"dist"),
        port: 8080,
        open:true
    },
    plugins: [
        new webpackPlugin({
            template: path.resolve(__dirname,"./newHTML/src/public/index.html"),
            chunks: ["index"]
        }),
        new webpackPlugin({
            template: path.resolve(__dirname,"./newHTML/src/public/about.html"),
            chunks: ["about"]
        })
    ]
}